//
//  LWZ_MusicMoreMoreViewController.m
//  MusicFM
//
//  Created by 李光耀 on 16/1/13.
//  Copyright © 2016年 LWZ. All rights reserved.
//

#import "LWZ_MusicMoreMoreViewController.h"
#import "LWZ_MusicMoreTableViewCellY.h"
#import "LWZ_MusicPlayViewController.h"

@interface LWZ_MusicMoreMoreViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong)UITableView *tableView;

@end

@implementation LWZ_MusicMoreMoreViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self creatTableView];
    [self.tableView reloadData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)creatTableView{
    self.tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
#warning xib 注册重用池方法
    [self.tableView registerNib:[UINib nibWithNibName:@"LWZ_MusicMoreTableViewCellY"bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"LWZ_MusicMoreTableViewCellYIdentifier"];
    
    
    //添加添加阴影效果
    self.tableView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    
    self.tableView.layer.shadowOffset = CGSizeMake(-8, 8);
    
    self.tableView.layer.shadowOpacity = 1;
    
    self.tableView.clipsToBounds = false;
    self.tableView.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0];
    
    [self.view addSubview:self.tableView];
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    LWZ_MusicMoreTableViewCellY *cell = [tableView dequeueReusableCellWithIdentifier:@"LWZ_MusicMoreTableViewCellYIdentifier"];
    cell.dic = _arraySource[indexPath.row];
    cell.backgroundColor = [UIColor clearColor];
    return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _arraySource.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 75;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    LWZ_MusicPlayViewController *play = [[LWZ_MusicPlayViewController alloc]init];
    play.strurl = _arraySource[indexPath.row][@"url"];
    play.arraySource = _arraySource;
//    play.tupianurlnumber = indexPath.row;
    [self.navigationController pushViewController:play animated:YES];
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
